#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long LL;

int main(int argc, char** argv) {
    LL n,m,k;
    cin>>n>>m>>k;
    LL x=-1e9, mark=0;
    LL a,b;
    for (LL i=0; i<k; ++i) {
        scanf("%lld %lld", &a, &b);
        if (a*m+b*(n-m) >= x) {
            x = a*m+b*(n-m);
            mark = i;
        }
    }
    if (mark==0) printf("%lld", n);
    else printf("0");
    for (LL i=1; i<k; ++i) {
        if (i!=mark) printf(" 0");
        else printf(" %lld", n);
    }
    printf("\n");
    return 0;
}
